//
//  TestCollectionVC.m
//  高仿暴走斗图
//
//  Created by key on 16/3/28.
//  Copyright © 2016年 huangsongyao. All rights reserved.
//

#import "TestCollectionVC.h"

static NSString * Identifier =  @"TestIdentifier";

@interface TestCollectionVC ()

@end

@implementation TestCollectionVC

- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self.collectionView registerClass:[HSYBaseCollectionViewCell class] forCellWithReuseIdentifier:Identifier];
    self.selectIndexPathCell = ^(id collectionViewCell, NSIndexPath *indexPath) {
      
        NSLog(@"cell:%@", collectionViewCell);
        NSLog(@"indexPath%@", indexPath);
    };
    self.isCanReflesh = YES;
    // Do any additional setup after loading the view.
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    return 15;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    HSYBaseCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:Identifier forIndexPath:indexPath];
    [cell sizeToFit];
    if (!cell) {
        cell = [collectionView dequeueReusableCellWithReuseIdentifier:Identifier forIndexPath:indexPath];
    }
    cell.isAddArrows = YES;
    cell.isAddBottomLine = YES;
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    
    [super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
}


- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    int arcH = 100;
    CGFloat height = arcH+(arc4random()%arcH);
    return CGSizeMake(arcH, height);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
